/*
 * Copyright (C) 2017 Pingan, Inc. All Rights Reserved.
 */

package com.pingan.haofang.searchcloud.web.index.vo;

import com.pingan.haofang.searchcloud.common.constants.Constants;
import com.pingan.haofang.searchcloud.common.constants.QueryOptimizeEnum;
import com.pingan.haofang.searchcloud.common.validator.annotation.EnumOption;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * RPC导入任务视图
 *
 * @author zhangbi617
 * @date 03/05/2017
 */
@ApiModel(description = "RPC导入任务视图")
public class FullRpcIndexDataSourceVO {

    @ApiModelProperty(value = "rpc的URL")
    @NotBlank
    @URL
    @Length(max = 512)
    private String rpcUrl;

    @ApiModelProperty(value = "rpc对应方法名")
    @NotBlank
    @Pattern(regexp = Constants.METHOD_PATTERN, message = "common.method.pattern.error")
    @Length(max = 45)
    private String rpcMethod;

    @ApiModelProperty(value = "全量导入设置,不设置则默认主键")
    private String indexField;

    @ApiModelProperty(value = "分页大小，增量时不需要")
    @NotNull
    @Max(value = 5000 ,message = "分页最大不能超过5000")
    private Integer pageSize;

    @ApiModelProperty(value = "起始页码，增量时不需要")
    @NotNull
    private Integer startPage;

    @ApiModelProperty(value = "线程数量，增量时不需要")
    @Max(value = 10)
    private Integer threadNum;

    @ApiModelProperty(value = "是否查询优化，1是，0否")
    @EnumOption(enumClass = QueryOptimizeEnum.class)
    private Integer queryOptimize;

    public String getRpcUrl() {
        return rpcUrl;
    }

    public void setRpcUrl(String rpcUrl) {
        this.rpcUrl = rpcUrl;
    }

    public String getRpcMethod() {
        return rpcMethod;
    }

    public void setRpcMethod(String rpcMethod) {
        this.rpcMethod = rpcMethod;
    }

    public String getIndexField() {
        return indexField;
    }

    public void setIndexField(String indexField) {
        this.indexField = indexField;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getStartPage() {
        return startPage;
    }

    public void setStartPage(Integer startPage) {
        this.startPage = startPage;
    }

    public Integer getThreadNum() {
        return threadNum;
    }

    public void setThreadNum(Integer threadNum) {
        this.threadNum = threadNum;
    }

    public Integer getQueryOptimize() {
        return queryOptimize;
    }

    public void setQueryOptimize(Integer queryOptimize) {
        this.queryOptimize = queryOptimize;
    }

    @Override
    public String toString() {
        return "FullRpcIndexDataSourceVO{" +
                "rpcUrl='" + rpcUrl + '\'' +
                ", rpcMethod='" + rpcMethod + '\'' +
                ", indexField='" + indexField + '\'' +
                ", pageSize=" + pageSize +
                ", startPage=" + startPage +
                ", threadNum=" + threadNum +
                ", queryOptimize=" + queryOptimize +
                '}';
    }
}
